﻿<%@ Page Title="Routes" Language="C#" MasterPageFile="~/Auth/Auth.Master" AutoEventWireup="true"
    CodeBehind="Routes.aspx.cs" Inherits="CoastalClimbing.Auth.Routes" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <script type="text/javascript">
    jQuery(function ($) {
        $('.maskClass').mask("99/99/9999");
    });
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <span class="thirtyWhite">Routes</span>
    <br />
    <asp:Label ID="lblMessage" runat="server" ForeColor="red" />
    <br />
    <table>
        <tr>
            <td>
                Name
            </td>
            <td>
                Description
            </td>
            <td>
                Rating
            </td>
            <td>
                Wall
            </td>
            <td>
                Setter
            </td>
            <td>
                Date set
            </td>
            <td>
                Date exp
            </td>
        </tr>
        <tr>
            <td valign="top">
                <asp:TextBox ID="txtName" runat="server" MaxLength="50"></asp:TextBox>
            </td>
            <td valign="top">
                <asp:TextBox ID="txtDescription" runat="server" TextMode="MultiLine" Rows="5" Columns="20"></asp:TextBox>
            </td>
            <td valign="top">
                <asp:DropDownList ID="ddlRating" runat="server" />
            </td>
            <td valign="top">
                <asp:DropDownList ID="ddlWall" runat="server" />
            </td>
            <td valign="top">
                <asp:DropDownList ID="ddlSetter" runat="server" />
            </td>
            <td valign="top">
                <asp:TextBox ID="txtDateSet" runat="server" MaxLength="10" Columns="7" CssClass="maskClass"></asp:TextBox>
            </td>
            <td valign="top">
                <asp:TextBox ID="txtDateExp" runat="server" MaxLength="10" Columns="7" CssClass="maskClass"></asp:TextBox>
            </td>
            <td valign="top">
                <asp:Button ID="btnAdd" runat="server" Text="Add" OnClick="btnAdd_Click" />
            </td>
        </tr>
    </table>
    <hr />
    <asp:GridView ID="grvRoutes" runat="server" AutoGenerateColumns="false" DataKeyNames="ID"
        OnRowEditing="EditRecord" OnRowUpdating="UpdateRecord" OnRowDataBound="RowDataBound"
        OnRowCancelingEdit="CancelRecord" OnRowDeleting="DeleteRecord" AutoGenerateEditButton="True"
        GridLines="Both" CellPadding="4" ForeColor="#333333">
        <Columns>
            <asp:TemplateField HeaderText="Name">
                <ItemTemplate>
                    <asp:Label ID="lblName" runat="server" Text='<%# Eval("Name") %>' />
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:TextBox ID="txtName" runat="server" Text='<%# Eval("Name") %>' MaxLength="50" />
                </EditItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Description">
                <ItemTemplate>
                    <asp:Label ID="lblDescription" runat="server" Text='<%# Eval("Description") %>' />
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:TextBox ID="txtDescription" runat="server" Text='<%# Eval("Description") %>' />
                </EditItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Rating">
                <ItemTemplate>
                    <asp:Label ID="lblRating" runat="server" Text='<%# Eval("Rating") %>' />
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:DropDownList ID="ddlRating" runat="server" />
                    <asp:Label ID="lblRatingID" runat="server" Text='<%# Eval("RatingID") %>' Visible="false" />
                </EditItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Wall">
                <ItemTemplate>
                    <asp:Label ID="lblWall" runat="server" Text='<%# Eval("Wall") %>' />
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:DropDownList ID="ddlWall" runat="server" />
                    <asp:Label ID="lblWallID" runat="server" Text='<%# Eval("WallID") %>' Visible="false" />
                </EditItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Setter">
                <ItemTemplate>
                    <asp:Label ID="lblSetter" runat="server" Text='<%# Eval("Setter") %>' />
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:DropDownList ID="ddlSetter" runat="server" />
                    <asp:Label ID="lblSetterID" runat="server" Text='<%# Eval("SetterID") %>' Visible="false" />
                </EditItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Date Set">
                <ItemTemplate>
                    <asp:Label ID="lblDateSet" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "DateSet", "{0:MM/dd/yyyy}") %>' />
                </ItemTemplate>
                <EditItemTemplate>           
                    <asp:TextBox ID="txtDateSet" runat="server" Text='<%# Eval("DateSet") %>' class="maskClass" Columns="7" />
                </EditItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Date Exp">
                <ItemTemplate>
                    <asp:Label ID="lblDateExp" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "DateExp", "{0:MM/dd/yyyy}") %>' />
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:TextBox ID="txtDateExp" runat="server" Text='<%# Eval("DateExp") %>' class="maskClass" Columns="7" />
                </EditItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField>
                <ItemTemplate>
                    <asp:LinkButton ID="LinkButton1" runat="server" CommandArgument='<%# Eval("ID") %>'
                        CommandName="Delete" Text="Delete" ForeColor="Black" />
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
        <FooterStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
        <RowStyle BackColor="#E3EAEB" />
        <EditRowStyle BackColor="#7C6F57" />
        <SelectedRowStyle BackColor="#C5BBAF" Font-Bold="True" ForeColor="#333333" />
        <PagerStyle BackColor="#666666" ForeColor="White" HorizontalAlign="Center" />
        <HeaderStyle BackColor="#ffd80b" Font-Bold="True" ForeColor="333333" />
        <AlternatingRowStyle BackColor="White" />
    </asp:GridView>

    <hr />

    <asp:TextBox ID="txtDeleteAllRoutes" runat="server" MaxLength="10" /> 
    <asp:Button ID="btnDeleteAllRoutes" runat="server" Text="Delete All Routes" 
        onclick="btnDeleteAllRoutes_Click" />

</asp:Content>
